home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 August / MW 8 2003 CD1.iso / Inside Macworld / Product News / gimp-1.2.4.sit / gimp-1.2.4 / plug-ins / perl / examples / example-net < prev    next >
Encoding:
Text File  |  2000-03-28  |  676 b   |  33 lines

  1. #!/usr/bin/perl
  2.  
  3. # example for the gimp-perl-server (also called Net-Server)
  4.  
  5. use Gimp;
  6.  
  7. Gimp::on_lib {
  8.    print STDERR "$0: this script is not intended to be run from within the gimp!\n";
  9. };
  10.  
  11. Gimp::on_net {
  12.   # simple benchmark ;)
  13.  
  14.   $img=new Gimp::Image(600,300,RGB);
  15.   # the is the same as $img = new Image(600,300,RGB)
  16.  
  17.   $bg=$img->layer_new(30,20,RGB_IMAGE,"Background",100,NORMAL_MODE);
  18.  
  19.   $bg->add_layer(1);
  20.  
  21.   new Gimp::Display($img);
  22.  
  23.   for $i (0..255) {
  24.      Palette->set_background([$i,255-$i,$i]);
  25.      $bg->edit_fill(BG_IMAGE_FILL);
  26.      Display->displays_flush();
  27.   }
  28. #  Gimp::Net::server_quit;  # kill the gimp-perl-server-extension (ugly name)
  29. };
  30.  
  31. exit main;
  32.  
  33.